package com.zhangjun.socket.handler;

import com.zhang.view.chat.IChatMethod;
import com.zhangjun.application.UIService;
import com.zhangjun.chat.protocol.friend.AddFriendResponse;
import com.zhangjun.socket.MyBizHandler;
import io.netty.channel.Channel;
import javafx.application.Platform;

public class AddFriendHandler extends MyBizHandler<AddFriendResponse> {

    public AddFriendHandler(UIService uiService) {
        super(uiService);
    }

    @Override
    public void channelRead(Channel channel, AddFriendResponse msg) {
        IChatMethod chat = uiService.getChat();
        Platform.runLater(() -> {
            chat.addFriendUser(true, msg.getFriendId(), msg.getFriendNickName(), msg.getFriendHead());
        });
    }

}